#define DEBUG
#include <cstdio>

using namespace std;

const int maxn=10000;

int count(int x, int *a, int n, int l, int k) {
  int ret=0;
  for (int i=1; i<=n-l+1; i++) {
    if (x!=i) {
      int t=k;
      for (int j=1; j<=l && t>=0; j++) {
	t -= a[i+j-1]!=a[x+j-1];
      }
      ret += t>=0;
    }
  }
  return ret;
}

int main() {
  freopen("lottery.in", "r", stdin);
  freopen("lottery.out", "w", stdout);

  static int a[maxn+1];
  int n, l;
  scanf("%d %d", &n, &l);
  for (int i=1; i<=n; i++) {
    scanf("%d", a+i);
  }

  int q;
  scanf("%d", &q);
  for (int i=1; i<=q; i++) {
    int k;
    scanf("%d", &k);

    for (int i=1; i<=n-l+1; i++) {
      printf("%d ", count(i, a, n, l, k));
    }
    printf("\n");
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
